//
//  MenuButtonView.m
//  THiOSWeb
//
//  Created by songliu on 13-12-10.
//  Copyright (c) 2013年 Dexterlirush. All rights reserved.
//

#import "MenuButtonView.h"

@interface MenuButtonView ()
@property (nonatomic, strong) UILabel *customizedTitleLabel;
@property (nonatomic, strong) UIImageView *triangleImageView;
@end

@implementation MenuButtonView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        _triangleImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Pic1-05"]];
        [self addSubview:_triangleImageView];
        
        _customizedTitleLabel = [[UILabel alloc] initWithFrame:self.bounds];
        _customizedTitleLabel.textColor = [UIColor whiteColor];
        _customizedTitleLabel.backgroundColor = [UIColor clearColor];
        [self addSubview:_customizedTitleLabel];
        _customizedTitleLabel.textAlignment = NSTextAlignmentLeft;
    }
    return self;
}

- (void)setCustomizedTitle:(NSString *)title
{
    self.customizedTitleLabel.text = title;
    CGSize size = [title sizeWithFont:self.customizedTitleLabel.font constrainedToSize:CGSizeMake(CGRectGetWidth(self.bounds) - 5, 30) lineBreakMode:NSLineBreakByTruncatingTail];
    self.triangleImageView.frame = CGRectMake(size.width, 25, 5, 5);
}

@end
